<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex flex-wrap align-center justify-between benben-position-layout flex personalCenter_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center personalCenter_fd0_0'>
				</view>
				<text class='personalCenter_fd0_1'>个人中心</text>
				<view class='flex flex-wrap align-center justify-end personalCenter_fd0_2'>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>

			<!---flex布局flex布局开始-->
			<block>
				<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout personalCenter_flex_1">
					<view class='flex flex-wrap align-center personalCenter_fd1_0' @tap.stop="handleuser" v-if="isLogin===true">
						<image class='personalCenter_fd1_0_c0' mode="aspectFill"
							:src="info.url ? info.url : require('@/static/images/129.png')" v-if="isMaCoach==1"></image>
						<image class='personalCenter_fd1_0_c0' mode="aspectFill"
							:src="info.ossUrl ? info.ossUrl : require('@/static/images/129.png')" v-else></image>
						<view class='flex flex-direction flex-wrap align-stretch flex-sub personalCenter_fd1_0_c1'>
							<view class='flex flex-wrap align-center personalCenter_fd1_0_c1_c0'>
								<text class='personalCenter_fd1_0_c1_c0_c0' v-if="isMaCoach==1">HI，{{info.coachName || '你好'}}</text>
								<text class='personalCenter_fd1_0_c1_c0_c0' v-else>HI，{{info.memberName || '你好'}}</text>
							</view>
						</view>
						<text class='fu-iconfont2  personalCenter_fd1_0_c2'>&#xe7f2;</text>
					</view>
					<view class='flex flex-wrap align-center self-center personalCenter_fd1_0' @tap.stop="handleJumpDiy"
						data-type="navigateTo" :data-url="`/pages/tabBar/passwordLogin/passwordLogin`" v-if="isLogin===false">
						<image class='personalCenter_fd1_1_c0' mode="aspectFit" src='../../../static/images/129.png'></image>
						<view class='flex flex-wrap align-center personalCenter_fd1_0_c1_c0'>
							<text class='personalCenter_fd1_0_c1_c0_c0'>点击登录</text>
						</view>
						<text class='fu-iconfont2  personalCenter_fd1_1_c2'>&#xe7f2;</text>
					</view>
				</view>
				<!---flex布局flex布局结束-->
				<!---flex布局flex布局开始-->
				<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout personalCenter_flex_2">
					<!-- 					<view class='flex flex-direction flex-wrap align-stretch personalCenter_fd2_0' v-if="isMaCoach!=1">
						<view class='flex flex-wrap align-center justify-between'>
							<text class='personalCenter_fd2_0_c0_c0' style="font-weight: bold;">我的权益</text>
						</view>
						<view class='flex flex-wrap align-center justify-between personalCenter_fd2_0_c1'>
							<view class='flex flex-direction flex-wrap align-center personalCenter_fd2_0_c1_c0' @tap.stop="handleA">
								<image class='personalCenter_fd2_0_c1_c0_c0' mode="aspectFit" src='../../../static/images/7.png'>
								</image>
								<text class='personalCenter_fd2_0_c1_c0_c1'>我的会员卡</text>
							</view>

							<view class='flex flex-direction flex-wrap align-center personalCenter_fd2_0_c1_c0' @tap.stop="handleBB">
								<image class='personalCenter_fd2_0_c1_c0_c0' mode="aspectFit" src='../../../static/images/9.png'>
								</image>
								<text class='personalCenter_fd2_0_c1_c0_c1'>预约记录</text>
							</view>
							<view class='flex flex-direction flex-wrap align-center personalCenter_fd2_0_c1_c0' @tap.stop="handleD"
								v-if="isOnlines==1">
								<image class='personalCenter_fd2_0_c1_c0_c0' mode="aspectFit" src='../../../static/images/10.png'>
								</image>
								<text class='personalCenter_fd2_0_c1_c0_c1'>我的订单</text>
							</view>
							<view class='flex flex-direction flex-wrap align-center personalCenter_fd2_0_c1_c0' @tap.stop="handleA"
								v-else>
								<image class='personalCenter_fd2_0_c1_c0_c0' mode="aspectFit" src='../../../static/images/8.png'>
								</image>
								<text class='personalCenter_fd2_0_c1_c0_c1'>我的课程卡</text>
							</view>
						</view>
					</view> -->
					<view class='flex flex-direction flex-wrap align-stretch personalCenter_fd2_0'>
						<view class='flex flex-wrap align-center justify-between'>
							<text class='personalCenter_fd2_0_c0_c0' style="font-weight: bold;">我的服务</text>
						</view>
						<view class='flex flex-wrap align-center justify-between personalCenter_fd2_0_c1'>

							<view class='flex flex-direction flex-wrap align-center personalCenter_fd2_0_c1_c0'
								@tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/myB/contact/contact`"
								v-if="isOnlines==0">
								<image class='personalCenter_fd2_0_c1_c0_c0' mode="aspectFit" src='../../../static/images/12.png'>
								</image>
								<text class='personalCenter_fd2_0_c1_c0_c1'>联系客服</text>
							</view>

							<view class='flex flex-direction flex-wrap align-center personalCenter_fd2_0_c1_c0' @tap.stop="handleD"
								v-if="isOnlines==1">
								<image class='personalCenter_fd2_0_c1_c0_c0' mode="aspectFit" src='../../../static/images/381.png'>
								</image>
								<text class='personalCenter_fd2_0_c1_c0_c1'>预约记录</text>
							</view>

							<block>
								<view class='flex flex-direction flex-wrap align-center personalCenter_fd2_0_c1_c0'
									@tap.stop="handleJumpDiy" data-type="navigateTo"
									:data-url="`/pages/my/platformIntroduction/platformIntroduction`">
									<image class='personalCenter_fd2_0_c1_c0_c0' mode="aspectFit" src='../../../static/images/13.png'>
									</image>
									<text class='personalCenter_fd2_0_c1_c0_c1'>平台介绍</text>
								</view>
							</block>
							<!-- 							<block v-if="isOnlines==1">
								<view class='flex flex-direction flex-wrap align-center personalCenter_fd2_0_c1_c0'
									@tap.stop="handleYAOQING" v-if="isMaCoach!=1">
									<image class='personalCenter_fd2_0_c1_c0_c0' mode="aspectFit" src='../../../static/images/11.png'>
									</image>
									<text class='personalCenter_fd2_0_c1_c0_c1'>人脸采集</text>
								</view>
							</block> -->

							<view class='flex flex-direction flex-wrap align-center personalCenter_fd2_0_c1_c0' style="width: 144rpx;"
								@tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/my/system/system`">
								<image class='personalCenter_fd2_0_c1_c0_c0' mode="aspectFit" src='../../../static/images/14.png'>
								</image>
								<text class='personalCenter_fd2_0_c1_c0_c1'>设置/反馈</text>
							</view>
						</view>
					</view>
					<!-- 					<view class='flex flex-direction flex-wrap align-stretch personalCenter_fd2_0' v-if="isMaCoach==1">
						<view class='flex flex-wrap align-center justify-between'>
							<text class='personalCenter_fd2_0_c0_c0' style="font-weight: bold;">教练服务</text>
						</view>
						<view class='flex flex-wrap align-center justify-between personalCenter_fd2_0_c1'>

							<view class='flex flex-direction flex-wrap align-center personalCenter_fd2_0_c1_c0'
								@tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/my/coachhexiao/coachhexiao`">
								<image class='personalCenter_fd2_0_c1_c0_c0' mode="aspectFit" src='../../../static/images/13.png'>
								</image>
								<text class='personalCenter_fd2_0_c1_c0_c1'>课程核销</text>
							</view>
						</view>
					</view> -->
					<!-- 					<block v-if="isLogin">

						<view class='flex flex-direction flex-wrap align-stretch personalCenter_fd2_0'>
							<view class='flex flex-wrap align-center justify-between'>
								<text class='personalCenter_fd2_0_c0_c0' style="font-weight: bold;">我的权益</text>
							</view>
							<view style="display: flex;align-items: center;">
								<view class='flex flex-wrap align-center justify-between personalCenter_fd2_0_c1' style="margin-right: 100rpx;">
									<view class='flex flex-direction flex-wrap align-center personalCenter_fd2_0_c1_c0'
										@tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/homePage/qrcode/qrcode`">
										<image class='personalCenter_fd2_0_c1_c0_c0' mode="aspectFit" src='../../../static/images/1_24.png'>
										</image>
										<text class='personalCenter_fd2_0_c1_c0_c1'>入场二维码</text>
									</view>
								</view>
								
								<view class='flex flex-wrap align-center justify-between personalCenter_fd2_0_c1'>
									<view class='flex flex-direction flex-wrap align-center personalCenter_fd2_0_c1_c0'
										@tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/myB/ticketWriteOff/ticketWriteOff`">
										<image class='personalCenter_fd2_0_c1_c0_c0' mode="aspectFit" src='../../../static/images/381.png'>
										</image>
										<text class='personalCenter_fd2_0_c1_c0_c1'>团购核销</text>
									</view>
								</view>
		
							</view>

						</view>



					</block> -->
				</view>
			</block>
			<benben-popup v-model="popupShow16569923508001" :mask="true" :mask-close-able="true" mode='center'>
				<!---退出登录flex布局开始-->
				<view class="flex flex-direction flex-wrap align-center system_flex_2">
					<text class='system_fd2_0'>提示</text>
					<text class='system_fd2_1'>是否登录？</text>
					<view class='flex align-center system_fd2_2'>
						<button class='system_fd2_2_c0' @tap.stop="popupShow16569923508001=false">取消</button>
						<button class='system_fd2_2_c1' @tap.stop="logOutFunc()">确定</button>
					</view>
				</view>

				<!---退出登录flex布局结束-->

			</benben-popup>



			<!---flex布局flex布局结束-->


		</view>
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},


		data() {
			return {
				popupShow16569923508001: false,
				"dataMessage": {
					"invite_code": "",
					"address": "",
					"address_code": "",
					"hobby": "",
					"tags": "",
					"id": "",
					"userlevel_id": "",
					"mobile": "",
					"real_name": "",
					"avatar": "",
					"account": "",
					"email": "",
					"birthday": "",
					"gender": "",
					"create_time": "",
					"user_money": "",
					"freeze_money": "",
					"total_consumption_money": "",
					"score": "",
					"_mobile": "",
					"coupon": "",
					"collection_count": "",
					"browse_count": "",
					"total_money": "",
					"certified": "",
					"nickname": "",
					"is_pay_password": "",
					"follow_count": ""
				},
				"messageNum": '',
				is_show: true,
				status: '-1',
				renzhengid: '',
				fuwuid: '',
				isTimedaoqi: '',
				isMaCoach: '',
				info: '',
				isOnlines: '',
				homeList: []
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},
			isLogin() {
				return this.$store.state.token == '' ? false : true;
			},
			userInfo: {
				get() {
					return this.$store.state.userInfo
				},
				set() {
					this.$store.commit('updateUserInfo', value)
				},
			}
		},
		watch: {},
		onLoad(options) {
			this.Online()
			

		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			let info = uni.getStorageSync('USER_INFO')
			// if (info.isMaCoach) {
			// 	this.isMaCoach = info.isMaCoach
			// }
			// if (this.isLogin) {
			// 	this.queryUserInfoFunc()
			// }


		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//隐藏
			async Online() {
				//请求方法
				let res = await this.$api.get(global.apiUrls.isOnline);
				this.isOnlines = res.data.msg
				console.log(this.isOnlines, '0隐藏  1上线成功isOnlinesisOnlinesisOnlines')
				if (this.isOnlines == 1) {
					this.gethomeList()
					console.log('上线模式，且未登录状态')
					// this.isUserInfo()
				}
			},
			handleuser() {
				return
				let info = uni.getStorageSync('USER_INFO')
				if (info.isMaCoach) {
					return false
				} else {
					uni.navigateTo({
						url: '/pages/my/user/user'
					})
				}
			},

			//查询会员卡列表
			async gethomeList() {

				// let requestUrl = `${global.apiUrls.orderList}/${this.userId}`;
				let res = await this.$api.get(global.apiUrls.appointmentRecord, {
					pageSize: 9999
				});
				if (res.data.code == 200) {
					this.homeList = res.data.rows
				} else if (res.data.code == 401) {
					this.$store.commit('logout')
					uni.removeStorageSync('Ida');
					uni.removeStorageSync('code');
					this.$urouter.reLaunch(`/pages/tabBar/passwordLogin/passwordLogin`);
					return
				} else {
					// this.$message.info(res.data.msg);
					return
				}
			},

			handleYAOQING() {
				if (this.isLogin === false) {
					this.$message.info('您还未登录')
					setTimeout(() => {
						this.$urouter.reLaunch(`/pages/tabBar/passwordLogin/passwordLogin`);
					}, 1000)
					return
				} else {
					uni.navigateTo({
						url: `/pages/my/invite/invite`
					})
				}
			},
			handleAA() {
				if (this.isLogin === false) {
					this.$message.info('您还未登录')
					setTimeout(() => {
						this.$urouter.reLaunch(`/pages/tabBar/passwordLogin/passwordLogin`);
					}, 1000)
					return
				} else {
					uni.navigateTo({
						url: `/pages/myB/contactInformation/contactInformation`
					})
				}
			},
			handleA() {
				if (this.isLogin === false) {
					this.$message.info('您还未登录')
					setTimeout(() => {
						this.$urouter.reLaunch(`/pages/tabBar/passwordLogin/passwordLogin`);
					}, 1000)
					return
				} else {
					uni.navigateTo({
						url: `/pages/my/myAttention/myAttention`
					})
				}
			},
			handleBB() {
				if (this.isLogin === false) {
					this.$message.info('您还未登录')
					setTimeout(() => {
						this.$urouter.reLaunch(`/pages/tabBar/passwordLogin/passwordLogin`);
					}, 1000)
					return
				} else {
					uni.navigateTo({
						url: `/pages/myB/collect/collect`
					})
				}
			},
			handleC() {
				if (this.isLogin === false) {
					this.$message.info('您还未登录')
					setTimeout(() => {
						this.$urouter.reLaunch(`/pages/tabBar/passwordLogin/passwordLogin`);
					}, 1000)
					return
				} else {
					uni.navigateTo({
						url: `/pages/my/privateEducation/privateEducation`
					})
				}
			},
			handleD() {
				if (this.isLogin === false) {
					this.$message.info('您还未登录')
					setTimeout(() => {
						this.$urouter.reLaunch(`/pages/tabBar/passwordLogin/passwordLogin`);
					}, 1000)
					return
				} else {
					uni.navigateTo({
						url: `/pages/my/service/service`
					})
				}
			},
			queryUserInfoFunc() {
				let info = uni.getStorageSync('USER_INFO')
				if (info.isMaCoach) {
					console.log(info, '教练的登录信息')
					this.getcoachinfo(info.coachId)
				} else {
					this.getuserinfo()
				}
			},
			//获取用户详细信息
			async getuserinfo() {
				//请求方法
				//数据验证
				let id = uni.getStorageSync('userId')
				let requestUrl = `${global.apiUrls.memberInfo}/${id}`;
				let datauserInfo = await this.$api.get(requestUrl);
				if (datauserInfo.data.msg == "认证失败，无法访问系统资源") {
					this.$store.commit('logout')
					uni.removeStorageSync('venueInfo')
					uni.removeStorageSync('keyPhone');
					uni.removeStorageSync('code');
					uni.removeStorageSync('iv');
					uni.removeStorageSync('userId');
					uni.removeStorageSync('encryptedData');
					uni.removeStorageSync('gzhOpenId');
					uni.removeStorageSync('IMGINFO');
					this.$urouter.reLaunch(`/pages/tabBar/passwordLogin/passwordLogin`);
				}
				if (datauserInfo.data.code != 200) {
					this.$message.info(datauserInfo.data.msg);
					return
				}

				this.info = datauserInfo.data.data
				console.log(this.info, '用户信息')
			},
			//获取教练详细信息
			async getcoachinfo(id) {
				//请求方法
				//数据验证
				let requestUrl = `${global.apiUrls.coachinfo}/${id}`;
				let datacoachInfo = await this.$api.get(requestUrl);
				if (datacoachInfo.data.code != 200) {
					this.$message.info(datacoachInfo.data.msg);
					return
				}
				this.info = datacoachInfo.data.data
				console.log(this.info, '教练信息')
			},



		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
	}

	.loading_css {
		// padding-top: 72rpx;
		text-align: center;
		position: fixed;
		left: 50%;
		top: 50%;
		transform: translate(-50%, -50%);

		view {
			color: #999999;
			font-size: 22rpx;
			margin-top: 16rpx;
		}
	}

	.personalCenter_flex_0 {
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		background: #fff;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.personalCenter_fd0_2 {
		width: 200rpx;
		height: 88rpx;
		position: relative;
	}

	.personalCenter_fd0_1 {
		color: #333;
		font-size: 36rpx;
		font-weight: 500;
		line-height: 50rpx;
	}

	.personalCenter_fd0_0 {
		width: 200rpx;
		height: 88rpx;
	}

	.personalCenter_flex_1 {
		padding: 0rpx 28rpx 0rpx 28rpx;
		margin-top: 16rpx;
	}

	.personalCenter_fd1_2_c1_c2 {
		width: 20rpx;
		height: 20rpx;
		margin: 0rpx 0rpx 0rpx 8rpx;
	}

	.personalCenter_fd1_2_c1_c1 {
		color: rgba(240, 102, 0, 1);
		font-size: 24rpx;
		font-weight: 500;
	}

	.system_flex_2 {
		background: #fff;
		width: 540rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.system_fd2_0 {
		font-size: 36rpx;
		font-weight: 800;
		line-height: 44rpx;
		color: #333333;
		margin: 40rpx 0rpx 40rpx 0rpx;
	}

	.system_fd2_1 {
		line-height: 44rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: rgba(102, 102, 102, 1);
	}

	.system_fd2_2_c1 {
		border-top: 1px solid #eee;
		border-left: 1px solid #eee;
		background: transparent;
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 16rpx 0rpx;
		font-size: 32rpx;
		color: #167deb;
		width: 268rpx;
	}

	.system_fd2_2_c0 {
		border-top: 1px solid #eee;
		background: #fff;
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 0rpx 16rpx;
		font-size: 32rpx;
		color: rgba(153, 153, 153, 1);
		padding: 0rpx 103rpx 0rpx 103rpx;
	}

	.system_fd2_2 {
		margin: 37rpx 0rpx 0rpx 0rpx;
	}

	.personalCenter_fd1_2_c1_c0 {
		color: #b8aaaa;
		font-size: 24rpx;
		font-weight: 500;
		line-height: 33rpx;
	}

	.personalCenter_fd1_2_c1 {
		margin: 32rpx 0rpx 0rpx 0rpx;
	}

	.personalCenter_fd1_2_c0 {
		color: var(--benbenFontColor0);
		font-size: 32rpx;
		font-weight: 700;
	}

	.personalCenter_fd1_2 {
		//background: url(/static/images/6.png) no-repeat;
		margin: 52rpx 0rpx 0rpx 0rpx;
		padding: 30rpx 0rpx 30rpx 45rpx;
		background-size: 100% auto;
	}

	.personalCenter_fd1_1_c2 {
		color: var(--benbenFontColor3);
		margin: 0rpx 0rpx 0rpx auto;
	}

	.personalCenter_fd1_1_c0 {
		width: 128rpx;
		height: 128rpx;
		border-radius: 67rpx 67rpx 67rpx 67rpx;
		margin: 0rpx 32rpx 0rpx 0rpx;
	}

	.personalCenter_fd1_0_c2 {
		color: var(--benbenFontColor3);
		font-size: 26rpx;
	}

	.personalCenter_fd1_0_c1_c0_c0 {
		color: currentColor;
		font-size: 32rpx;
		font-weight: 500;
	}

	.personalCenter_fd1_0_c1_c0 {
		margin: 0rpx 0rpx 0rpx 0rpx;
	}

	.personalCenter_fd1_0_c1 {
		margin: 0rpx 0rpx 0rpx 24rpx;
	}

	.personalCenter_fd1_0_c0 {
		width: 128rpx;
		height: 128rpx;
		border-radius: 64rpx;
		border: 4rpx #FFFFFF solid;
	}

	.personalCenter_fd1_0 {
		margin: 40rpx 0rpx 0rpx 0rpx;
		padding-left: 8rpx;
	}

	.personalCenter_flex_2 {
		padding: 0rpx 28rpx 0rpx 28rpx;
	}

	.personalCenter_fd2_3_c0_c2 {
		width: 14rpx;
		height: 26rpx;
		margin: 0rpx 0rpx 0rpx auto;
	}

	.personalCenter_fd2_2_c0_c3 {
		width: 14rpx;
		height: 26rpx;
	}

	.personalCenter_fd2_2_c0_c2 {
		color: #999999;
		margin: 0rpx 16rpx 0rpx auto;
	}

	.personalCenter_fd2_2_c0_c0 {
		width: 40rpx;
		height: 40rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.personalCenter_fd2_2 {
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		padding: 32rpx 24rpx 32rpx 24rpx;
		margin: 20rpx 0rpx 0rpx 0rpx;
	}

	.personalCenter_fd2_0_c1_c0_c1 {
		color: var(--benbenFontColor0);
		font-size: 24rpx;
		font-weight: 400;
		line-height: 33rpx;
		margin: 16rpx 0rpx 0rpx 0rpx;
	}

	.personalCenter_fd2_0_c1_c0_c0 {
		width: 56rpx;
		height: 56rpx;
	}

	.personalCenter_fd2_0_c1_c0 {
		position: relative;
		width: 150rpx;
	}

	.personalCenter_fd2_0_c1 {
		margin: 32rpx 0rpx 0rpx 0rpx;
	}

	.personalCenter_fd2_0_c0_c0 {
		color: rgba(51, 51, 51, 1);
		font-size: 28rpx;
		font-weight: 400;
	}

	.personalCenter_fd2_0 {
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		padding: 24rpx 16rpx 25rpx 24rpx;
		margin: 20rpx 0rpx 0rpx 0rpx;
	}
</style>